using System.Collections.Generic;
using Examples;

namespace Examples.StringTemplate
{
    public class Renderer
    {
        public string Render(string template, PropertyBag bag, IEnumerable<IRenderer> renderers)
        {
            var stringTemplate = new Antlr.StringTemplate.StringTemplate(template);
            bag.ForEach(item => stringTemplate.SetAttribute(item.Key, item.Value));
            renderers.ForEach(renderer => stringTemplate.RegisterAttributeRenderer(renderer.ObjectType(), renderer));
            return stringTemplate.ToString();
        }
    }
}